//
//  OwnerCarInfoCell.m
//  ICrEAM
//
//  Created by Cty on 2016/11/08.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "OwnerCarInfoCell.h"

@implementation OwnerCarInfoCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (UILabel *)customerName{
    if(!_customerName){
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(ActualWidth(20), ActualHeight(30), ActualWidth(40), ActualHeight(40))];
        imageView.image = [UIImage imageNamed:Appointment_Customer];
        
        
        _customerName = [[UILabel alloc]initWithFrame:CGRectMake(imageView.rightEdge+10, ActualHeight(16),ActualWidth(140), ActualHeight(34))];
        _customerName.font = [UIFont systemFontOfSize:ActualWidth(18)];
        
        _customerName.textAlignment = NSTextAlignmentLeft;
        
        _customerName.textColor = Color(0x000000);
        [self addSubview:imageView];
        [self addSubview: _customerName];
        
        
    }
    return _customerName;
    
}
- (UILabel *)customerPhone{
    if(!_customerPhone){
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(ActualWidth(20), ActualHeight(30), ActualWidth(40), ActualHeight(40))];
        imageView.image = [UIImage imageNamed:Appointment_Customer];
        _customerPhone = [[UILabel alloc]initWithFrame:CGRectMake(imageView.rightEdge+10, self.customerName.bottomEdge,ActualWidth(140), ActualHeight(34))];
        _customerPhone.font = [UIFont systemFontOfSize:ActualWidth(18)];
        
        _customerPhone.textAlignment = NSTextAlignmentLeft;
        
        _customerPhone.textColor = Color(0x666666);
        
        [self addSubview: _customerPhone];
        
        
        
    }
    return _customerPhone;
    
}



- (UILabel *)plateNum{
    if(!_plateNum){
        
        _plateNum = [[UILabel alloc]initWithFrame:CGRectMake(self.customerName.rightEdge, ActualHeight(16), ActualWidth(260), ActualHeight(34))];
        
        _plateNum.textColor = [UIColor blackColor];
        _plateNum.textAlignment = NSTextAlignmentCenter;
        _plateNum.font = [UIFont systemFontOfSize:ActualWidth(18)];
        
        [self addSubview:_plateNum];
        
        //分割线
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(self.customerName.rightEdge, 0, 1, ActualHeight(95))];
        view.backgroundColor = [UIColor whiteColor];
        [self addSubview:view];
        
        
    }
    return _plateNum;

}
- (UILabel *)VINLabel{
    if(!_VINLabel){
        
        _VINLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.customerName.rightEdge, self.plateNum.bottomEdge, ActualWidth(260), ActualHeight(34))];
        
        _VINLabel.textColor = Color(0x666666);
        _VINLabel.textAlignment = NSTextAlignmentCenter;
        _VINLabel.font = [UIFont systemFontOfSize:ActualWidth(18)];
        
        [self addSubview:_VINLabel];
        
        
        
    }
    return _VINLabel;
}
- (UILabel *)modelNameLabel{
    if(!_modelNameLabel){
        
        _modelNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.plateNum.rightEdge, 0, ActualWidth(360), ActualHeight(95))];
        
        _modelNameLabel.textColor = [UIColor blackColor];
        _modelNameLabel.textAlignment = NSTextAlignmentCenter;
        _modelNameLabel.font = [UIFont systemFontOfSize:ActualWidth(18)];
        
        [self addSubview:_modelNameLabel];
        
        //分割线
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(self.plateNum.rightEdge, 0, 1, ActualHeight(95))];
        view.backgroundColor = [UIColor whiteColor];
        [self addSubview:view];
        
        
    }
    
    return _modelNameLabel;
    
}


- (UIButton *)btnGetCar{
    if(!_btnGetCar){
        _btnGetCar = [[UIButton alloc]initWithFrame:CGRectMake(self.modelNameLabel.rightEdge+(ScreenWidth-self.modelNameLabel.rightEdge-50)/2, ActualHeight(20), ActualWidth(50), ActualHeight(55))];
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(ActualWidth(10), 0, ActualHeight(30), ActualWidth(30))];
        imageView.image = [UIImage imageNamed:Common_Preview];
        [_btnGetCar addSubview:imageView];
        
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, imageView.bottomEdge+5, ActualWidth(50), ActualHeight(20))];
        [_btnGetCar addSubview:label];
        label.text = @"预览";
        label.textColor = TitleColor;
        label.textAlignment = NSTextAlignmentCenter;
        [_btnGetCar addSubview:label];
        
        [_btnGetCar addTarget:self action:@selector(didClickPreviewButton) forControlEvents:UIControlEventTouchUpInside];
        
        [self addSubview: _btnGetCar];
        
        //右侧分割线
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(self.modelNameLabel.rightEdge, 0, 1, ActualHeight(95))];
        view.backgroundColor = [UIColor whiteColor];
        [self addSubview:view];
        
        
    }
    return _btnGetCar;
    
}

- (void)didClickPreviewButton{
    if ([self.delegate respondsToSelector:@selector(didClickPreViewWithIndex:)]) {
        [self.delegate didClickPreViewWithIndex:self.index];
    }
    
}

//- (void)updateDataWithModel:(ICMAppointmentTodayModel *)model{
//    self.contentView.backgroundColor = Color(0xF1F3F3);
//    self.time.text = model.time?[ICrEAMTool getDateWithTimeInterval:model.time]:@"";
//    self.plateNum.text = model.plateNum?:@"";
//    self.status.text = model.status?[ICrEAMTool getCodeModelForCode:[NSString stringWithFormat:@"%@",model.status]].desc:@"";
//    self.customerName.text = model.customerName?:@"";
//    self.customerPhone.text = model.customerPhone?:@"";
//    self.assistantName.text = model.assistantName?:@"";
//    self.assistantPhone.text = model.assistantPhone?:@"";
//    self.btnGetCar.hidden = NO;
//    self.btnPreview.hidden = NO;
//    
//}
@end
